home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / share / xresprobe / rigprobe.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2007-03-17  |  3.0 KB  |  110 lines

  1. #!/bin/sh
  2. # Usage: rigprobe.sh driver screentype laptop
  3. # Copyright (C) 2005 Canonical Ltd
  4. # Author: Daniel Stone <daniel.stone@ubuntu.com>
  5. #  This program is free software; you can redistribute it and/or modify
  6. #  it under the terms of the GNU General Public License as published by
  7. #  the Free Software Foundation; version 2 of the License.
  8. #
  9. #  This program is distributed in the hope that it will be useful,
  10. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. #  GNU General Public License for more details.
  13. #
  14. #  You should have received a copy of the GNU General Public License with
  15. #  the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL-2;
  16. #  if not, write to the Free Software Foundation, Inc., 59 Temple Place,
  17. #  Suite 330, Boston, MA  02111-1307  USA
  18. #
  19. # On Debian systems, the complete text of the GNU General Public
  20. # License, version 2, can be found in /usr/share/common-licenses/GPL-2.
  21.  
  22. DATADIR="/usr/share/xresprobe"
  23.  
  24. if [ -n "$XRESPROBE_DRIVER" ]; then
  25.   DRIVER="$XRESPROBE_DRIVER"
  26. else
  27.   DRIVER="$1"
  28. fi
  29. if [ -n "$XRESPROBE_DEBUG" ]; then
  30.   echo "rigprobe: assuming $DRIVER as driver" >&2
  31. fi
  32.  
  33. SCREENTYPE="$2"
  34. LAPTOP="$3"
  35.  
  36. rignoddc() {
  37.   if [ -n "$XRESPROBE_DEBUG" ]; then
  38.     echo "rigprobe: returning failed DDC" >&2
  39.   fi
  40.   if [ -n "$LAPTOP" ]; then
  41.     DISPTYPE="lcd/lvds"
  42.   fi
  43. }
  44.  
  45. rigddc() {
  46.   if [ -n "$XRESPROBE_DEBUG" ]; then
  47.     echo "rigprobe: returning DDC from $XRESPROBE_RIG_DDC" >&2
  48.   fi
  49.   DDCOUT="$("$DATADIR/ddcprobe.sh" "$XRESPROBE_RIG_DDC")"
  50.   RETCODE="$?"
  51.   RES="$(echo "$DDCOUT" | grep "^res:" | sed -e 's/^res: *//;')"
  52.   IDENTIFIER="$(echo "$DDCOUT" | grep "^name:" | sed -e 's/^name: *//;')"
  53.   FREQ="$(echo "$DDCOUT" | grep "^freq:" | sed -e 's/^freq: *//;')"
  54.   DISPTYPE="$(echo "$DDCOUT" | grep "^disptype:" | sed -e 's/^disptype: *//;')"
  55.  
  56.   # well, not necessarily, but it's a pretty good guess
  57.   if [ -n "$DISPTYPE" ] && [ "$DISPTYPE" = "lcd" ]; then
  58.     DISPTYPE="lcd/tmds"
  59.   fi
  60. }
  61.  
  62. rigprobe() {
  63.   if [ -n "$XRESPROBE_DEBUG" ]; then
  64.     echo "rigprobe: returning LCD size from $XRESPROBE_RIG_LOG" >&2
  65.   fi
  66.   RES="$("$DATADIR/lcdsize.sh" $DRIVER $XRESPROBE_RIG_LOG)"
  67. }
  68.  
  69. rigdepth() {
  70.   if [ -n "$XRESPROBE_DEBUG" ]; then
  71.     echo "rigprobe: checking for broken i8xx BIOS with no 24bpp modes" >&2
  72.     echo "          from $XRESPROBE_RIG_LOG" >&2
  73.   fi
  74.   FORCEDEPTH="$("$DATADIR/bitdepth.sh" $DRIVER $XRESPROBE_RIG_LOG)"
  75. }
  76.  
  77. if [ "$XRESPROBE_RIG" = "noddc" ]; then
  78.   rignoddc
  79. elif [ "$XRESPROBE_RIG" = "ddc" ]; then
  80.   rigddc
  81. elif [ "$XRESPROBE_RIG" = "probe" ]; then
  82.   rigprobe
  83. fi
  84.  
  85. if [ "$DRIVER" = "i810" ] && [ -n "$XRESPROBE_RIG_LOG" ] && \
  86.    [ -e "$XRESPROBE_RIG_LOG" ]; then
  87.   rigdepth
  88. fi
  89.  
  90. if [ -n "$XRESPROBE_DEBUG" ]; then
  91.   echo "id: $IDENTIFIER" >&2
  92.   echo "res: $RES" >&2
  93.   echo "freq: $FREQ" >&2
  94.   echo "disptype: $DISPTYPE" >&2
  95.   if [ -n "$FORCEDEPTH" ]; then
  96.     echo "depth: $FORCEDEPTH" >&2
  97.   fi
  98. fi
  99.  
  100. echo "id: $IDENTIFIER"
  101. echo "res: $RES"
  102. echo "freq: $FREQ"
  103. echo "disptype: $DISPTYPE"
  104. if [ -n "$FORCEDEPTH" ]; then
  105.   echo "depth: $FORCEDEPTH"
  106. fi
  107.  
  108. exit 0
  109.